﻿Public Class HoSoBenhNhan

    Private Sub HoSoBenhNhan_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Me.BenhNhanTableAdapter.Fill(Me.PCV_CLINICDataSet_Don.BenhNhan)
        Me.TuNgayIDateEdit.EditValue = getNgayDauThang(Today())
        Me.DenNgayIDateEdit.EditValue = getNgayCuoiThang(Today())
    End Sub

    Private Sub BarButtonItemLamTuoi_ItemClick_1(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLamTuoi.ItemClick
        If IsNothing(Me.LoaiBenhNhanISearchLookupEdit.EditValue) Then
            DevExpress.XtraEditors.XtraMessageBox.Show("Xin vui lòng chọn 'Loại Bệnh Nhân' !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            Me.GetHoSoBenhNhanTableAdapter.Fill(Me.PCV_CLINICDataSetTongHop.getHoSoBenhNhan, CDate(Me.TuNgayIDateEdit.EditValue), CDate(Me.DenNgayIDateEdit.EditValue), Me.LoaiBenhNhanISearchLookupEdit.EditValue.ToString)
        End If
    End Sub

    Private Sub BarButtonItemBaoCao_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemBaoCao.ItemClick
        If IsNothing(Me.LoaiBenhNhanISearchLookupEdit.EditValue) Then
            DevExpress.XtraEditors.XtraMessageBox.Show("Xin vui lòng chọn 'Loại Bệnh Nhân' !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            Me.BarButtonItemLamTuoi.PerformClick()
            Dim report As Report_HoSoBenhNhan = New Report_HoSoBenhNhan
            report.GetHoSoBenhNhanTableAdapter1.Fill(Me.PCV_CLINICDataSetTongHop.getHoSoBenhNhan, CDate(Me.TuNgayIDateEdit.EditValue), CDate(Me.DenNgayIDateEdit.EditValue), Me.LoaiBenhNhanISearchLookupEdit.EditValue.ToString)
            report.TuNgay.Value = CDate(Me.TuNgayIDateEdit.EditValue)
            report.DenNgay.Value = CDate(Me.DenNgayIDateEdit.EditValue)
            report.LoaiBN.Value = Me.LoaiBenhNhanISearchLookupEdit.Properties.GetDisplayValueByKeyValue(Me.LoaiBenhNhanISearchLookupEdit.EditValue)
            report.ShowRibbonPreview()
        End If
    End Sub
End Class
